package com.example.shop.service.impl;

import com.example.shop.entity.Organization;
import com.example.shop.dao.OrganizationMapper;
import com.example.shop.service.OrganizationService;
import org.springframework.stereotype.Service;
import jakarta.annotation.Resource;

import java.util.List;

/**
 * (Organization)表服务实现类
 *
 * @author makejava
 * @since 2025-03-26 09:26:31
 */
@Service("organizationService")
public class OrganizationServiceImpl implements OrganizationService {
    @Resource
    private OrganizationMapper organizationMapper;

    /**
     * 通过ID查询单条数据
     *
     * @param organizationid 主键
     * @return 实例对象
     */
    @Override
    public Organization queryById(Integer organizationid) {
        return this.organizationMapper.queryById(organizationid);
    }


    /**
     * 新增数据
     *
     * @param organization 实例对象
     * @return 实例对象
     */
    @Override
    public Organization insert(Organization organization) {
        this.organizationMapper.insert(organization);
        return organization;
    }

    /**
     * 修改数据
     *
     * @param organization 实例对象
     * @return 实例对象
     */
    @Override
    public Organization update(Organization organization) {
        this.organizationMapper.update(organization);
        return this.queryById(organization.getOrganizationid());
    }

    /**
     * 通过主键删除数据
     *
     * @param organizationid 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer organizationid) {
        return this.organizationMapper.deleteById(organizationid) > 0;
    }

    @Override
    public List<Organization> queryAll() {
        return null;
    }
}
